<html>
<head><meta charset="utf-8"><title>Idea for custom lint groups · clippy · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/index.html">clippy</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Idea.20for.20custom.20lint.20groups.html">Idea for custom lint groups</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="245919236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/257328-clippy/topic/Idea%20for%20custom%20lint%20groups/near/245919236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Michael Wright <a href="https://rust-lang.github.io/zulip_archive/stream/257328-clippy/topic/Idea.20for.20custom.20lint.20groups.html#245919236">(Jul 14 2021 at 04:53)</a>:</h4>
<p>I don't know if this will work but it seems plausible. <br>
Just allow clippy driver to receive allow/warn/deny flags via env variables. Now the allow/warn/deny flags can be set in <a href="http://build.rs">build.rs</a> via <code>cargo:rustc-env</code> commands (probably). This means 'custom groups' can be packaged in crates and enabled via <a href="http://build.rs">build.rs</a> in the style of <code>vergen</code>.</p>
<p>Cargo.toml:</p>
<div class="codehilite"><pre><span></span><code>[package]
#..
build = &quot;build.rs&quot;

[dependencies]
#..

[build-dependencies]
lint_crate = &quot;5&quot;
</code></pre></div>
<p><a href="http://build.rs">build.rs</a>:</p>
<div class="codehilite"><pre><span></span><code>use lint_crate;

fn main() -&gt; Result&lt;()&gt; {
  // Generate the `cargo:rustc-env` insructions to enable the lints as desired.
 lint_crate::enable_essential_lints();
 lint_crate::enable_another_lint_group();
}
</code></pre></div>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>